# -*- coding:utf-8 -*-
"""
Author：Administrator
Date:2021年10月14日
"""
import pandas as pd
import numpy as np

path = '../数据文件/课件028-029/透视.xlsx'

data= pd.read_excel(path)

# data2 = pd.pivot_table(data,index=['部门', '销售人员'], values=['数量', '金额'])
# data2 = pd.pivot_table(data,index=['部门', '销售人员'],
#                        values=['数量', '金额'],
#                        columns='所属区域')
data2 = pd.pivot_table(data,index=['部门', '销售人员'],
                       values=['数量', '金额'],
                       columns='所属区域',aggfunc=[sum, np.mean])


# print(data.head())
print(data2)